package cn.enited.devtools.apiaggregator.consts;

import java.util.concurrent.TimeUnit;

public final class ApiConst {

    public static final int UNFOUND_INDEX = -1;

    public static final String COMPLETABLE_NAME_SPLIT_TOKEN = "$";

    public static final String PROJECT_PATH_REDIS_SPLIT_TOKEN = "@";

    public static final String CACHE_SYNC_KEY_SPLIT_TOKEN = "#";

    public static class PARAM_TYPE {
        public static final int PRIMITIVE = 0;
        public static final int RT_OBJECT = 1; // 运行时才能知道是什么类型，Java Object 或者 JSON Object
        public static final int JSON_ARRAY = 2;
    }

    public static class PARAM_SOURCE {
        public static final int REQUEST_BODY = 0;
        public static final int HEAD = 1;
        public static final int RESPONSE = 2;
    }

    public static class CACHE_LOCK {
        public static final String KEY = CommonConst.REDIS.KEY_PREFIX + "cache";
        public static final String ANALYSIS_KEY_PREFIX = KEY + "_alys";
        public static final String PATH_KEY_PREFIX = KEY + "_path";
        public static final String PARAM_KEY_PREFIX = KEY + "_param";
        public static final long EXPIRED = 500L;
        public static final TimeUnit EXPIRED_UNIT = TimeUnit.MILLISECONDS;
    }

    public static class SYNC_TYPE {
        public static final String PROJECT_PATH = "path";
        public static final String ANALYSIS = "alys";
    }
}
